// i will TLE
// run: time -p $exec < input
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <unordered_map>
#include <unordered_set>

void scan(int & a)
{
	a = 0;
	bool flag = false;
	char ch = std::getchar();
	if (ch == '-')
		flag = true;
	else if (ch >= '0' && ch <= '9')
		a = ch - '0';

	while ((ch = std::getchar()) >= '0' && ch <= '9')
		a = a * 10 + ch - '0';
	if (flag) a = -a;
}

struct data { int x, y; };
using pair = std::pair<int, int>;

struct pair_hash
{
	std::size_t operator()(pair const& k) const
	{
		return std::hash<int>()(k.first) ^
			(std::hash<int>()(k.second) << 4);
	}
};

struct pair_equal
{
	bool operator()(const pair& lhs, const pair& rhs) const
	{
		return lhs.first == rhs.first && lhs.second == rhs.second;
	}
};

int const mo = 1000000007;
int const maxn = 1007;
int n;
data da[maxn];

template <class T>
T abs(T x) { return x < 0 ? -x : x; }

template <class T>
T gcd(T x, T y) { return !y ? x : gcd(y, x % y); }

pair normal(pair a)
{
	long long tmp = gcd(a.first, a.second);
	a.first /= tmp; a.second /= tmp;
	if (a.first < 0) { a.first = -a.first; a.second = -a.second; }
	else if (!a.first) { a.second = abs(a.second); }
	return a;
}

int quick(int a, long long b)
{
	if (!b) return 1;
	long long ret = quick(a, b / 2);
	ret = (ret * ret) % mo;
	if (b & 1) ret = (ret * a) % mo;
	return ret;
}

std::unordered_map<pair, int, pair_hash, pair_equal> mm;
std::unordered_set<pair, pair_hash, pair_equal> all;

int main()
{
	int T; scan(T);
	while (T--) {
		scan(n);
		for (int i = 0; i < n; i++) { scan(da[i].x); scan(da[i].y); }
		all.clear();

		long long ans = 0;
		for (int i = 0; i < n; i++) {
			mm.clear();
			int count = 0;
			bool out = false;
			for (int j = i; j < n; j++) {
				long long tx = da[j].x - da[i].x, ty = da[j].y - da[i].y;
				if (!tx && !ty) { count++; continue; }
				auto tmp = normal({tx, ty});
				if (all.count(tmp)) { out = true; continue; }
				mm[tmp]++;
				out = true;
				all.insert(tmp);
			}

			long long tmp = quick(2, count) - count - 1;
			if (!out) {
				ans += tmp;
				ans = (ans + mo) % mo;
				break;
			}

			long long cc = -1;
			for (auto t : mm) {
				cc++;
				long long x = t.second + count;
				ans += quick(2, x) - x - 1;
				ans = (ans + mo) % mo;
			}
			if (cc > 0) {
				ans -= cc * tmp;
				ans = (ans + mo) % mo;
			}
		}
		printf("%lld\n", ans);
	}
}

